package com.lefeng.cockpit.common.bean.po.datasource;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lefeng.cockpit.common.bean.po.BasePO;
import com.lefeng.cockpit.common.handler.AESEncryptHandler;
import com.lefeng.cockpit.common.handler.JSONArrayTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * 数据源配置实体类(dwh_config_datasource)
 *
 * @author weifw
 */

@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "dc_datax_datasource", autoResultMap = true)
public class DataSourcePO extends BasePO {

    @TableId
    @ApiModelProperty(value = "自增主键")
    private Integer id;

    @ApiModelProperty(value = "数据源名称")
    private String dsName;

    @ApiModelProperty(value = "数据源类型")
    private String dsType;

    @ApiModelProperty(value = "数据源分组")
    private String dsGroup;

    @ApiModelProperty(value = "数据库名")
    private String dbName;

    @ApiModelProperty(value = "用户名")
//    @TableField(typeHandler = AESEncryptHandler.class)
    private String username;

    @ApiModelProperty(value = "密码")
    @TableField(typeHandler = AESEncryptHandler.class, value = "password")
    private String password;

    @ApiModelProperty(value = "url")
    private String url;

    @ApiModelProperty(value = "ip地址")
    private String ipAddress;

    @ApiModelProperty(value = "端口")
    private Integer port;

    @ApiModelProperty(value = "自定义参数")
    @TableField(typeHandler = JSONArrayTypeHandler.class)
    private JSONArray customParams;

    @ApiModelProperty(value = "驱动类")
    private String driverClass;

    @ApiModelProperty(value = "状态：1启用 2禁用")
    private Integer status;

    @ApiModelProperty(value = "描述")
    private String description;

    @ApiModelProperty(value = "备注", hidden = true)
    private String comments;

    @ApiModelProperty(value = "zookeeper地址", hidden = true)
    private String zkAdress;


}